{include file="head" /}

{include file="menu" /}


<!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              <!--state overview start-->
              
              <div class="row state-overview">
                <div class="container">
				        <form action="{:url('user/user_tongji_list')}" method="get">
                <div class="row">
                     <div class="col-lg-3 mar-10">
                      <div class="input-group">
                              <span class="input-group-addon">类型</span>
                              <select name="otype" class="selectpicker show-tick form-control">
                                  <option value="">默认不选</option>
                                  <option {if isset($getdata['otype']) && $getdata['otype'] === 0} selected="selected" {/if} value="0">客户</option>
                                  <option {if isset($getdata['otype']) && $getdata['otype'] == 101} selected="selected" {/if} value="101">代理商</option>
                              </select>
                          </div>
                      </div>
                      <div class="col-lg-5 mar-10">

                        <div class="input-group">
                            <span class="input-group-addon" id="basic-addon1">用户名</span>
                            <input type="text"  value="{$getdata['username']?$getdata['username']:''}"  class="form-control" name="username" placeholder="昵称/姓名/手机号/编号"/>
                        </div>
                      </div>

                      
                  <div class="mar-10">
                   <input type="submit" class="btn btn-success" value="搜索">
                  </div>
                </div>
                </form>
              </div>
              </div>
              <!--state overview end-->
              <br>
            <a href="{:url('user/user_tongji_list')}"><button type="submit" class="btn btn-primary">所有用户</button></a>&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="{:url('user/user_tongji_list',array('otype'=>0))}"><button type="submit" class="btn btn-success">所有客户</button></a>&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="{:url('user/user_tongji_list',array('otype'=>101))}"><button type="submit" class="btn btn-success">所有代理商</button></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            <a ><div  class="btn btn-danger">昨日收益:{$yester_info['sumploss']}</div></a>&nbsp;&nbsp;&nbsp;&nbsp;
            <a ><div  class="btn btn-danger">本月收益:{$thismonth_info['sumploss']}</div></a>
            <a ><div  class="btn btn-danger">总收益:{$alldata_info['sumploss']}</div></a>

              &nbsp;&nbsp;&nbsp;&nbsp;
            <br><br>
             <div class="row">
                  <div class="col-lg-12">
                      <section class="panel">
                          <header class="panel-heading">
                              用户列表
                          </header>
                          <table class="table table-striped table-advance table-hover">
                            <thead class="ordertable">
                              <tr>
                                <th>编号</th>
                                <th>客户信息</th>
                                <th>客户名称</th>

                                <th>订单数</th>
                                <th>账户余额</th>
                                <th>身份</th>
                                <th>持盈盾</th>
                                <th>昨日收益</th>
                                <th>本月收益</th>
                                <th>总收益</th>

                                <th>代理等级</th>
                                <th>归属代理商</th>
                                {if $otype == 3}
                                <th>操作</th>
                                {/if}
                            </tr>
                          </thead>
                          <tbody>
                          <!-- {volist name="userinfo" id="vo"} -->
                              <tr>
                                  <td>{$vo.uid}</td>
                                  <td>{$vo.username}【{$vo.utel}】</td>
                                  <td>{$vo.nickname}</td>

                                  <td>{:ordernum($vo['uid'])}</td>
                                  <td class="color_red">¥{$vo.usermoney?$vo.usermoney:'0'}</td>
                                  <td>{if $vo.otype == 0}客户{elseif $vo.otype == 101}代理商{/if}</td>

                                  <td>{$vo.moneybi?$vo.moneybi:'0'}</td>
                                  <td>{$vo.yd_sumploss?$vo.yd_sumploss:'0'}</td>
                                  <td>{$vo.m_sumploss?$vo.m_sumploss:'0'}</td>
                                  <td>{$vo.all_sumploss?$vo.all_sumploss:'0'}</td>


                                    <td>{$vo.dailigrade}</td>
                                  <td><a href="{:url('user_tongji_list',array('oid'=>$vo['oid']))}">{:getuser($vo['oid'],"username")}</a></td>
                                  
                                  <td>


                                      {if $vo.otype == 101}
                                      
                                      <a href="{:url('user_tongji_list',array('oid'=>$vo['uid']))}"> <button class="btn btn-primary btn-xs"> 下级客户 </button> </a>
                                      <a href="{:url('vipuserlist',array('oid'=>$vo['uid']))}"> <button class="btn btn-primary btn-xs"> 下级代理 </button> </a>
                                      <a href="{:url('yeji',array('uid'=>$vo['uid']))}"> <button class="btn btn-primary btn-xs"> 业绩 </button> </a>


                                      {/if}




                                      <a href="{:url('price/pricelist')}?username={$vo.username}"><button class="btn btn-primary btn-xs">资金报表</button></a>

                                      

                                  </td>
                                  
                              </tr>
							<!-- {/volist} -->
                              
                              
                              
                              </tbody>
                          </table>
                      </section>
                  </div>
              </div>
              
             {$userinfo->render()}

          </section>
      </section>
      <!--main content end-->
  </section>

{include file="foot" /}
<script>

function doustatus(type,uid) {
  
  if(type == 1){
    var con = '确定禁用吗？';
  }else if(type == 0){
    var con = '确定启用吗？';
  }else{
    layer.msg('参数错误！');
    return false;
  }

  if(!uid){
    layer.msg('参数错误！');
    return false;
  }

  layer.open({
    content: con,
    yes: function(index){
      //do something
      var formurl = "{:Url('user/doustatus')}";
      var data = 'uid='+uid+'&ustatus='+type;

      $.post(formurl,data,function(resdata){
        layer.msg(resdata.data);
        if(resdata.type == 1){
          history.go(0);
        }
      })

      
    }
  });
}

function dootype(type,uid) {
  
  if(type == 101){
    var con = '确定要成为代理商吗？';
  }else{
    layer.msg('参数错误！');
    return false;
  }

  if(!uid){
    layer.msg('参数错误！');
    return false;
  }

  layer.open({
    content: con,
    yes: function(index){
      //do something
      var formurl = "{:Url('user/dootype')}";
      var data = 'uid='+uid+'&otype='+type;

      $.post(formurl,data,function(resdata){
        layer.msg(resdata.data);
        if(resdata.type == 1){
          history.go(0);
        }
      })

      
    }
  });
}


function deleteuser (uid) {
  
  layer.open({
    content: '你确定删除吗？不可恢复哦，请慎重操作！',
    yes: function(index){
      //do something
      var formurl = "{:Url('user/deleteuser')}";
      var data = 'uid='+uid;

      $.post(formurl,data,function(resdata){
        layer.msg(resdata.data);
        if(resdata.type == 1){
          history.go(0);
        }
      })

      
    }
  });


}


</script>